package util;

public class Memorier {
	
	private double mem;
	private double maxmem;

	public Memorier() {
		mem = 0;
		maxmem = 0;
	}
	
	public void addLongSize(){
		mem += 32;
		maxmem = (maxmem < mem)? mem : maxmem;
	}
	
	public void removeLongSize(){
		mem -= 32;
	}
	
	public void addLongSize(long i){
		mem += 32*i;
		maxmem = (maxmem < mem)? mem : maxmem;
	}
	
	public void removeLongSize(long i){
		mem -= 32*i;
	}

	public void addDoubleSize(){
		mem += 64;
		maxmem = (maxmem < mem)? mem : maxmem;
	}
	
	public void removeDoubleSize(){
		mem -= 64;
	}
	
	public void addDoubleSize(long i){
		mem += 64*i;
		maxmem = (maxmem < mem)? mem : maxmem;	
	}
	
	public void removeDoubleSize(long i){
		mem -= 32*i;
	}
	
	public double getUsedMemB(){
		return maxmem;
	}
	
	public double getUsedMemKB(){
		return maxmem/Math.pow(2, 10);
	}
	
	public double getUsedMemMB(){
		return maxmem/Math.pow(2, 20);	
	}
	
}
